package site.marqstree.latte.ec.main.sort.content;

import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.entity.node.BaseNode;
import com.chad.library.adapter.base.provider.BaseNodeProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import site.marqstree.latte.ec.R;

/*
 * 项目名: EleCommerce
 * 包名: site.marqstree.latte.ec.main.sort.content
 * 文件名: RootNodeProvider
 * 创建者: marqstree
 * 创建时间: 2020/1/30 9:16
 * 描述: TODO
 */
public class RootNodeProvider extends BaseNodeProvider {
    @Override
    public int getItemViewType() {
        return 0;
    }

    @Override
    public int getLayoutId() {
        return R.layout.section_head_sort_content;
    }

    @Override
    public void convert(BaseViewHolder baseViewHolder, BaseNode baseNode) {
        RootNode entity = (RootNode) baseNode;
        baseViewHolder.setText(R.id.header, entity.getTitle());
    }

    @Override
    public void onClick(@NonNull BaseViewHolder helper, @NonNull View view, BaseNode data, int position) {
        getAdapter().expandOrCollapse(position);
    }
}
